package priv.utrix.micro.dto;

import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * 自定义用户信息存储到JWT中
 *
 * @author utrix
 * @date 2020/11/23
 */
@Getter
public class SecurityUserDto extends User {
    private static final long serialVersionUID = -4688585471082994585L;
    /**
     * 用户信息表主键id
     */
    private final Long id;

    /**
     * 权限集合
     */
    private final String[] authorityCodeList;

    public SecurityUserDto(String username, String password, Collection<? extends GrantedAuthority> authorities, Long id, String[] authorityCodeList) {
        super(username, password, authorities);
        this.id = id;
        this.authorityCodeList = authorityCodeList;
    }
}
